import os,zipfile
filepath=input('输入文件目录：')
def createzipfile(month):
    f=zipfile.ZipFile('test.zip','a')
    for dirpath,dirnames,filenames in os.walk(filepath):
        for filename in filenames:
            f.write(filepath)
    f.close()
for item in os.listdir(filepath):
    createzipfile(str(item))
